package model.commands;

import exceptions.InvalidCombination;
import exceptions.LockedDoorException;
import exceptions.NoDoorException;
import exceptions.TalkToPerson;
import exceptions.ThingNotInArea;
import view.input.InputWords;
import model.locations._World;


public class OpenCommand extends Command{

	_World world;

public OpenCommand(_World world) {
	this.world=world;
}

public String execute(InputWords words) throws TalkToPerson, InvalidCombination {

	if(!words.getWord2().equals("r")){
		if(!words.getWord2().equals("DOOR"))
			throw new InvalidCombination("open",words.getWord2());
	}
			return world.openCloseDoor(true);
			
}

}
